package com.globallogic.oopbasics.competence.generic;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author olena.strelchuk
 * 
 *         Create one-type Competencies Box
 */
public class CompetenceBoxOneType<C, T extends C> implements
		CompetenceBox<C, T> {
	private T element;

	private List<T> container;

	public CompetenceBoxOneType() {
		container = new ArrayList<T>();
	}

	@Override
	public List<T> getContainer() {
		return container;
	}

	@Override
	public boolean containsSame(final CompetenceBox<C, ? extends C> other,
			final EqualityComparator<C> comparator) {

		return comparator.compare(this.getContainer(), other.getContainer());
	}

	@Override
	public T get() {
		return element;
	}

	@Override
	public void put(final T element) {
		this.element = element;
		this.container.add(element);
	}

}
